import request from '@/utils/request'

/**
 * 获取角色列表
 * @param {Object} page 页码
 * @param {Object} pagesize 数据条数
 * @returns Pomise
 */
export const getSettingsAPI = (page, pagesize, total) => {
  return request({
    method: 'get',
    url: '/sys/role',
    params: {
      page,
      pagesize,
      total
    }
  })
}
/**
 * 删除角色
 * @param {String} id 角色id
 * @returns Promise
 */
export const delRoleAPI = (id) => {
  return request({
    method: 'delete',
    url: `/sys/role/${id}`
  })
}
/**
 * 新增角色
 * @param {Object} roleForm 角色表单
 * @returns Promise
 */
export const addRoleAPI = (roleForm) => {
  return request({
    method: 'post',
    url: '/sys/role',
    data: roleForm
  })
}
/**
 * 获取角色详情
 * @param {String} id 角色id
 * @returns Promise
 */
export const getRoleDetailAPI = (id) => {
  return request({
    method: 'get',
    url: `/sys/role/${id}`
  })
}
/**
 * 编辑角色
 * @param {Object} roleForm 角色表单
 * @returns Promise
 */
export const editRoleAPI = (roleForm) => {
  return request({
    method: 'put',
    url: `/sys/role/${roleForm.id}`,
    data: roleForm
  })
}
/**
 * 获取公司详情
 * @param {String} companyId 公司id
 * @returns Promise
 */
export const getCompanyDetailApI = (companyId) => {
  return request({
    method: 'get',
    url: `/company/{companyId}`
  })
}
